<template>
        <div>
            <ul>
                <li v-for="(good) in dataList" :key="good.id" @click="jumpDetail(good.id)">{{ good.text }}</li>
            </ul>
        </div>
</template>
<script>
export default{
        data(){
            return{
                dataList:[
                {
                    id:"001",
                    text:"商品1"
                },
                {
                    id:"002",
                    text:"商品2"
                },
                {
                    id:"003",
                    text:"商品3"
                },
            ]
            }
        },
        methods:{
            jumpDetail(id){
                // location.href = "/detail?id="+id +"&uname=tom" //原生跳转页面 实际上是get
                // this.$router.push("/detail/"+id) //动态路由
                this.$router.push({
                    name: "mydetail",
                    params:{
                        id
                    }
                })    //命名路由
            }
        }
    }
</script>
<style lang="scss" scoped>
</style>